package com.wangshouyu.mp.pay.unified;

import com.thoughtworks.xstream.annotations.XStreamAlias;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author 王守钰
 * @description 统一下单请求
 * @date 2020/8/13 8:52
 */
public abstract class BaseUnifiedRequest implements Serializable {

    /**
     * 公众账号ID
     * 微信支付分配的公众账号ID（企业号corpid即为此appId）
     */
    @XStreamAlias(value = "appid")
    private String appId;

    /**
     * 商户号
     * 微信支付分配的商户号
     */
    @XStreamAlias(value = "mch_id")
    private String mchId;

    /**
     * 自定义参数，
     * 可以为终端设备号(门店号或收银设备ID)，
     * PC网页或公众号内支付可以传"WEB"
     */
    @XStreamAlias(value = "device_info")
    private String deviceInfo;

    /**
     * 随机字符串
     * 随机字符串，不长于32位。
     */
    @XStreamAlias(value = "nonce_str")
    private String nonceStr;

    /**
     * 签名
     */
    @XStreamAlias(value = "sign")
    private String sign;

    /**
     * 签名类型
     * 签名类型，目前支持HMAC-SHA256和MD5，默认为MD5
     */
    @XStreamAlias(value = "sign_type")
    private String signType;

    /**
     * 商品描述
     */
    @XStreamAlias(value = "body")
    private String body;

    /**
     * 商品详情
     */
    @XStreamAlias(value = "detail")
    private String detail;

    /**
     * 附加数据
     */
    @XStreamAlias(value = "attach")
    private String attach;

    /**
     * 商户订单号
     */
    @XStreamAlias(value = "out_trade_no")
    private String outTradeNo;

    /**
     * 标价币种
     */
    @XStreamAlias(value = "fee_type")
    private String feeType;

    /**
     * 标价币种
     */
    @XStreamAlias(value = "total_fee")
    private Integer totalFee;

    /**
     * 终端IP
     */
    @XStreamAlias(value = "spbill_create_ip")
    private String spbillCreateIp;

    /**
     * 交易起始时间
     */
    @XStreamAlias(value = "time_start")
    private String timeStart;

    /**
     * 交易结束时间
     */
    @XStreamAlias(value = "time_expire")
    private String timeExpire;

    /**
     * 订单优惠标记
     */
    @XStreamAlias(value = "goods_tag")
    private String goodsTag;

    /**
     * 通知地址
     */
    @XStreamAlias(value = "notify_url")
    private String notifyUrl;

    /**
     * 交易类型
     */
    @XStreamAlias(value = "trade_type")
    private String tradeType;

    /**
     * 指定支付方式
     */
    @XStreamAlias(value = "limit_pay")
    private String limitPay;

    /**
     * 用户标识
     */
    @XStreamAlias(value = "openid")
    private String openid;

    /**
     * 电子发票入口开放标识
     */
    @XStreamAlias(value = "receipt")
    private String receipt;

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getMchId() {
        return mchId;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public String getDeviceInfo() {
        return deviceInfo;
    }

    public void setDeviceInfo(String deviceInfo) {
        this.deviceInfo = deviceInfo;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getSignType() {
        return signType;
    }

    public void setSignType(String signType) {
        this.signType = signType;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public String getAttach() {
        return attach;
    }

    public void setAttach(String attach) {
        this.attach = attach;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public String getFeeType() {
        return feeType;
    }

    public void setFeeType(String feeType) {
        this.feeType = feeType;
    }

    public Integer getTotalFee() {
        return totalFee;
    }

    public void setTotalFee(Integer totalFee) {
        this.totalFee = totalFee;
    }

    public String getSpbillCreateIp() {
        return spbillCreateIp;
    }

    public void setSpbillCreateIp(String spbillCreateIp) {
        this.spbillCreateIp = spbillCreateIp;
    }

    public String getTimeStart() {
        return timeStart;
    }

    public void setTimeStart(String timeStart) {
        this.timeStart = timeStart;
    }

    public String getTimeExpire() {
        return timeExpire;
    }

    public void setTimeExpire(String timeExpire) {
        this.timeExpire = timeExpire;
    }

    public String getGoodsTag() {
        return goodsTag;
    }

    public void setGoodsTag(String goodsTag) {
        this.goodsTag = goodsTag;
    }

    public String getNotifyUrl() {
        return notifyUrl;
    }

    public void setNotifyUrl(String notifyUrl) {
        this.notifyUrl = notifyUrl;
    }

    public String getTradeType() {
        return tradeType;
    }

    public void setTradeType(String tradeType) {
        this.tradeType = tradeType;
    }

    public String getLimitPay() {
        return limitPay;
    }

    public void setLimitPay(String limitPay) {
        this.limitPay = limitPay;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public String getReceipt() {
        return receipt;
    }

    public void setReceipt(String receipt) {
        this.receipt = receipt;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        BaseUnifiedRequest that = (BaseUnifiedRequest) o;
        return Objects.equals(appId, that.appId) &&
                Objects.equals(mchId, that.mchId) &&
                Objects.equals(deviceInfo, that.deviceInfo) &&
                Objects.equals(nonceStr, that.nonceStr) &&
                Objects.equals(sign, that.sign) &&
                Objects.equals(signType, that.signType) &&
                Objects.equals(body, that.body) &&
                Objects.equals(detail, that.detail) &&
                Objects.equals(attach, that.attach) &&
                Objects.equals(outTradeNo, that.outTradeNo) &&
                Objects.equals(feeType, that.feeType) &&
                Objects.equals(totalFee, that.totalFee) &&
                Objects.equals(spbillCreateIp, that.spbillCreateIp) &&
                Objects.equals(timeStart, that.timeStart) &&
                Objects.equals(timeExpire, that.timeExpire) &&
                Objects.equals(goodsTag, that.goodsTag) &&
                Objects.equals(notifyUrl, that.notifyUrl) &&
                Objects.equals(tradeType, that.tradeType) &&
                Objects.equals(limitPay, that.limitPay) &&
                Objects.equals(openid, that.openid) &&
                Objects.equals(receipt, that.receipt);
    }

    @Override
    public int hashCode() {
        return Objects.hash(appId, mchId, deviceInfo, nonceStr, sign, signType, body, detail, attach, outTradeNo, feeType, totalFee, spbillCreateIp, timeStart, timeExpire, goodsTag, notifyUrl, tradeType, limitPay, openid, receipt);
    }

    @Override
    public String toString() {
        return "BaseUnifiedRequest{" +
                "appId='" + appId + '\'' +
                ", mchId='" + mchId + '\'' +
                ", deviceInfo='" + deviceInfo + '\'' +
                ", nonceStr='" + nonceStr + '\'' +
                ", sign='" + sign + '\'' +
                ", signType='" + signType + '\'' +
                ", body='" + body + '\'' +
                ", detail='" + detail + '\'' +
                ", attach='" + attach + '\'' +
                ", outTradeNo='" + outTradeNo + '\'' +
                ", feeType='" + feeType + '\'' +
                ", totalFee=" + totalFee +
                ", spbillCreateIp='" + spbillCreateIp + '\'' +
                ", timeStart='" + timeStart + '\'' +
                ", timeExpire='" + timeExpire + '\'' +
                ", goodsTag='" + goodsTag + '\'' +
                ", notifyUrl='" + notifyUrl + '\'' +
                ", tradeType='" + tradeType + '\'' +
                ", limitPay='" + limitPay + '\'' +
                ", openid='" + openid + '\'' +
                ", receipt='" + receipt + '\'' +
                '}';
    }
}
